import pytest
import os
import allure
import time
if __name__ == '__main__':
    report_dir=r'..\reports'
    now = time.strftime('%Y-%m-%d_%H_%M_%S')
    report_name=rf'{report_dir}\{now}_html'

    args=[r'..\test_case','-vs',rf'--alluredir={report_dir}','--clean-alluredir']
    #在命令窗口运行以下
    cmd=rf'allure generate {report_dir} -o {report_name}'
    pytest.main(args)
    os.system(cmd)